<form class="form short-labels" id="megaEdit_expenseForm">
<input name="expenseId" id="expenseId" type="hidden" value="<?php echo $expense['ExpenseId'];?>">
<input name="currentRow" id="currentRow" type="hidden" value="<?php echo $row;?>">
<input name="rowTotal" id="rowTotal" type="hidden" value="<?php echo $total;?>">
<div class="dialog_title"><a class="dialog_x">X</a>
<h1>Edit Expense</h1>
</div>

<div class="dialog_wrapper">

<div class="buttons_container hidden" id="megaEdit_disabledActionBar"></div>

<div class="buttons_container" id="megaEdit_actions">
<div class="button" id="megaEdit_attachExpense" style="display: none;"><a
	href="#">Attach Expense</a></div>

<div class="button delete" id="megaEdit_detachExpense"
	style="display: none;"><a href="#">Detach Expense</a></div>
<?php if($expense['ReceiptId']<=0):?>
<div class="button" id="megaEdit_attachReceipt"><a
	href="#">Attach Receipt</a></div>
<?php else:?>
<div class="button delete" id="megaEdit_detachReceipt"
	style="display: block;"><a href="#">Detach Receipt</a></div>
<?php endif;?>
<div class="button qtip" id="megaEdit_splitExpense"
	style="display: block;"><a href="#">Split Expense</a></div>
<div class="button qtip" id="megaEdit_mergeExpense"
	style="display: none;"><a href="#">Merge</a></div>
<div class="button delete" id="megaEdit_deleteButton"
	style="display: block;"><a class="iconButton" href="#"></a></div>
<div class="button" id="megaEdit_undeleteButton" style="display: none;"><a
	href="#">Undelete</a></div>

<div class="floatRight" id="megaEdit_arrows">
<p id="megaEdit_collectionLocation" class="floatLeft marginRight"><strong><?php echo $row;?></strong>
of <strong><?php echo $total;?></strong> expenses</p>
<div class="button noMargin buttonsNextPrev">
<?php if($row > 1):?>
<a class="arrow collectionPrev iconButton" id="megaEdit_prev"></a>
<?php else:?>
<a class="arrow collectionPrev iconButton disabled" id="megaEdit_prev"></a>
<?php endif;?>
<?php if($row < $total):?>
<a class="arrow collectionNext iconButton" id="megaEdit_next"></a>
<?php else:?>
<a class="arrow collectionNext iconButton disabled" id="megaEdit_next"></a>
<?php endif;?>
</div>
</div>
</div>

<div class="floatWrapper">
<div id="megaEdit_leftSide" class="floatLeft">
<h3 class="textCenter">Expense</h3>

<div class="message_error" id="editTransaction_violationsContainer"
	style="display: none;">
<h3>Policy Violations</h3>
<div id="editTransaction_violationList"></div>
</div>

<fieldset>
<ol>
	<li><label>Date</label> <input value="<?php echo date('Y-m-d',strtotime($expense['Date']));?>"
		id="date" name="date" class="required calendar semwal_dtpicker"
		type="text"></li>
	<li><label>Merchant</label> <input value="<?php echo $expense['Merchant'];?>" id="merchant"
		name="merchant" type="text"></li>
	<li><label>From</label> <input id="fromPosition" name="fromPosition"
		type="text" value="<?php echo $expense['FromPosition'];?>"></li>
	<li><label>To</label> <input id="toPosition" name="toPosition"
		type="text" value="<?php echo $expense['ToPosition'];?>"></li>
	<li><label>Distance</label> <input name="miles"
		id="newExpense3_oneMileage_count" class="required short qtip"
		type="text"> <select name="unit" id="newExpense3_oneMileage_unit"
		class="marginLeft5 short qtip">
		<?php foreach ($units as $unit):?>
		<?php if($unit['Id'] == $expense['Unit']):?>
			<option value="<?php echo $unit['Id']?>" selected="selected"><?php echo $unit['UnitName'];?></option>
		<?php else:?>
			<option value="<?php echo $unit['Id']?>"><?php echo $unit['UnitName'];?></option>		
		<?php endif;?>
		<?php endforeach;?>
	</select> <span class="rate" id="newExpense3_mileageRate">at <a
		href="#settings#preferences" alt="Change Mileage Preferences"
		title="Change Mileage Preferences">$0.565</a> per mi.</span></li>
	<li><label>Currency</label> <select name="expenseCurrency"
		class="short">
		<?php foreach ($currencies as $currency):?>
		<?php if($currency['Id'] == $expense['CurrencyId']):?>
		<option value="<?php echo $currency['Id']?>" selected="selected"><?php echo $currency['CurrencyName'];?></option>
		<?php else:?>
		<option value="<?php echo $currency['Id']?>"><?php echo $currency['CurrencyName'];?></option>
		<?php endif;?>
		<?php endforeach;?>
	</select></li>
	<li><label>Amount</label> <input name="amount"
		id="newExpense3_oneMileage_amount" class="short qtip" type="text" value="<?php echo $expense['Total'];?>"></li>

	<li style="display: list-item;" class="checkbox" id="newExpense3_mileage_claimCustomer">
	<?php if($expense['ClaimCustomer']):?>
		<input value="true" id="claimCustomer" name="claimCustomer" type="checkbox" checked="checked"> 
	<?php else:?>
		<input value="true" id="claimCustomer" name="claimCustomer" type="checkbox"> 	
	<?php endif;?>
	<label for="claimCustomer">Claim Customer</label>
	</li>

	<h3>Details</h3>
	<li><label>Category</label> <select name="category" class="long qtip">
	<?php foreach ($categories as $category):?>
		<option value="<?php echo $category['Id']?>"><?php echo $category['CategoryName'];?></option>
		<?php endforeach;?>
	</select></li>
	<li><label>Description</label> <textarea name="item_description"
		rows="2" cols="10"><?php echo $expense['Description'];?></textarea></li>

	<li><label>Comment</label> <input maxlength="256" name="comment"
		type="text" value="<?php echo $expense['Comment'];?>"></li>
	<li id="dialog_newExpense3_chooseReport_mileage"><label>Report</label>
	<select name="reportID" class="reportSelector long">
		<option value="-1">---SELECT REPORT---</option>
		<?php foreach ($reports as $report):?>
		<?php if($report['Id'] == $expense['ReportId']):?>
			<option value="<?php echo $report['Id']?>" selected="selected"><?php echo $report['ReportName'];?></option>
		<?php else:?>
			<option value="<?php echo $report['Id']?>"><?php echo $report['ReportName'];?></option>
		<?php endif;?>
		<?php endforeach;?>
		<option disabled="disabled" class="separator" value="">----------</option>
		<option value="1">(create new report)</option>
	</select></li>
</ol>
</fieldset>

<div id="editTransaction_reject" style="display: none;">
<ol class="form labels-auto">
	<li><label for="comment">Or reject this expense only. The person who
	submitted the report will receive an email notification with the
	comment below.</label> <input type="text" name="comment"
		id="editTransaction_rejectComment"></li>
	<li class="submit">
	<div class="button delete"><a id="editTransaction_rejectButton"
		href="#">Reject Expense</a></div>
	</li>
</ol>
</div>

</div>
<!-- close expense left -->

<div id="megaEdit_receiptSide" class="floatRight">
<h3 class="textCenter">Receipt</h3>
<div id="megaEdit_receiptContainer">
<input id="editReceiptId" name="receiptId" type="hidden" value="<?php echo $expense['ReceiptId']!=NULL?$expense['ReceiptId']: NULL ;?>">
<div id="receipt_<?php $expense['ReceiptId'];?>" class="receipt_wrapper">
<?php 
$url = !($expense['ReceiptId']<=0)?$expense['Url']:(Yii::app()->baseUrl.'/images/icon-receipt_150_new.png');

?>
<div class="receipt DELETED attached"><span class="receiptID"><span class="transactionID"></span><img
	src="<?php echo $url;?>"
	id="receiptimg_<?php echo $expense['ReceiptId'];?>" class="receiptimage" style="top: -29px;"><a
	href="<?php echo $url;?>"
	class="fancy"></a></span>
<div class="receipt_caption">
<div class="receipt_actions">
<div class="button delete detach_receipt_button" style="display: none;"><a href="#">Detach</a></div>
<div class="button edit_rotate_button"><a href="#">Rotate</a></div>
<div class="button edit_crop_button"><a href="#">Crop</a></div>
<div class="button download_receipt_button"><a class="iconButton"
	target="_blank"
	href="<?php echo $expense['Url'];?>"></a></div>
</div>
</div>
</div>
<ol class="form floatRight short-labels">
	<li><input type="checkbox" value="true" id="megaEdit_zoom"><label
		for="megaEdit_zoom">Zoom </label></li>
</ol>
</div>
</div>
</div>
<!-- close receipt right --></div>
<!-- close floatWrapper -->

<div class="center">
<div class="button add"><a id="megaEdit_saveButton" href="#">Save</a></div>
</div>

</div>
</form>
<!-- close dialog_wrapper -->
